package com.example.carapi.service.implement;

import com.example.carapi.bean.CarSeries;
import com.example.carapi.mapper.CarSeriesMapper;
import com.example.carapi.service.CarSeriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarSeriesServiceImplement implements CarSeriesService {
    @Autowired
    private CarSeriesMapper carSeriesMapper;

    @Override
    public CarSeries getCarSeriesById(Long id) {
        return carSeriesMapper.getOne(id);
    }

    @Override
    public List<CarSeries> getCarSeriess() {
        return carSeriesMapper.getAll();
    }

    @Override
    public void addCarSeries(CarSeries carSeries) {
        carSeriesMapper.insert(carSeries);
    }

    @Override
    public void updateCarSeries(CarSeries carSeries) {
        carSeriesMapper.update(carSeries);
    }

    @Override
    public void deleteCarSeriesById(Long id) {
        carSeriesMapper.delete(id);
    }
}
